#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QSettings>
#include <windows.h>
#include <QDebug>
#include <QTimer>
#include <QStringList>
#include <QTime>
#include <QFileDialog>
#include <QCloseEvent>
#include <QSystemTrayIcon>
#include <QtGlobal>

#include "picturedb.h"
#include "systemtrayicon.h"
#include "parasettingdb.h"

const QString g_strRegAutoStart
    = QString("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
              "Windows\\CurrentVersion\\Run");

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

public slots:
    void OnChangeWallPaper();

signals:
    void updateModel();

protected:
    bool setWallPaper(const QString &src);
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);

private slots:
    void TimeOutSlot();
    void SearchFinshed();

    void closeEvent(QCloseEvent *e);
    void systemTrayIcon(QSystemTrayIcon::ActivationReason reason);
    int ConverteUnit( const QString &num);

    void OnAutoStart(bool bAutoStart);
    void OnLookUp();

    void OnSaveSetting();
    void OnPlay();
    void OnExit();
    void OnTimeChanged(const QString &num);
    void OnUnitChanged(int);

private:
    Ui::Widget *ui;
    PictureDB *m_pPicture;
    QTimer *m_pTimer;
    QStringList *m_pList;
    SystemTrayIcon *m_pTrayicon;
    ParaSettingDB *m_pParaSetting;
    QPoint m_Pos;
};

#endif // WIDGET_H
